﻿
@model OnlineEducation.Areas.Teacher.Models.UserEditModel
@{
    Layout = null;
}

<div class="modal-header">
    <h4 class="modal-title">修改教师账号</h4>


    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>

<form onsubmit="return SubmitForm(this,'/Teacher/Edit/')">
    <div class="modal-body p-4">
        <div asp-validation-summary="ModelOnly" class="text-danger"></div>
        <input type="hidden" asp-for="Id" />

        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label asp-for="UserName" class="control-label"></label>
                    <input asp-for="UserName" class="form-control" placeholder="输入手机号或者邮箱" onkeyup="this.value=this.value.replace(/^\s+|\s+$/g,'')" />
                    <span asp-validation-for="UserName" class="text-danger"></span>
                </div>
            </div>

            <div class="col-md-6">
                <div class="form-group">
                    <label asp-for="FullName" class="control-label"></label>
                    <input asp-for="FullName" class="form-control" placeholder="输入真实姓名" onkeyup="this.value=this.value.replace(/^\s+|\s+$/g,'')" />
                    <span asp-validation-for="FullName" class="text-danger"></span>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label asp-for="PhoneNumber" class="control-label"></label>
                    <input asp-for="PhoneNumber" class="form-control" placeholder="输入手机号" onkeyup="this.value=this.value.replace(/^\s+|\s+$/g,'')" />
                    <span asp-validation-for="PhoneNumber" class="text-danger"></span>
                </div>
            </div>

            <div class="col-md-6">
                <div class="form-group">
                    <label asp-for="Gender" class="control-label"></label>
                    <select asp-for="Gender" class="form-control" placeholder="输入性别" asp-items="Html.GetEnumSelectList<OnlineEducation.Enums.Gender>()"></select>

                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label asp-for="BirthDate" class="control-label"></label>
                    <input asp-for="BirthDate" class="form-control" placeholder="输入生日" />

                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label asp-for="Title" class="control-label"></label>
                    <input asp-for="Title" class="form-control" placeholder="输入头衔" />

                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                <div class="form-group">
                    <label asp-for="Signature" class="control-label"></label>
                    <input asp-for="Signature" class="form-control" placeholder="输入签名" />
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label asp-for="Avatar" class="control-label"></label>
                    <input type="hidden" name="Avatar" id="Avatar" value="@Model.Avatar" />
                    <div class="uploader">
                        <img id="avatar" class="avatar" src='@Model.Avatar' />
                        <div id="upload" class="upload-section"></div>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label asp-for="Intro" class="control-label"></label>
                    <textarea asp-for="Intro" class="form-control" rows="7" placeholder="输入个人介绍"></textarea>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label asp-for="Email" class="control-label"></label>
                    <input asp-for="Email" class="form-control" placeholder="输入邮箱" onkeyup="this.value=this.value.replace(/^\s+|\s+$/g,'')" />
                    <span asp-validation-for="Email" class="text-danger"></span>
                </div>
            </div>

            <div class="col-md-6">
                <div class="form-group">
                    <label asp-for="WeChat" class="control-label"></label>
                    <input asp-for="WeChat" class="form-control" placeholder="输入微信号" />

                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label asp-for="WeiBo" class="control-label"></label>
                    <input asp-for="WeiBo" class="form-control" placeholder="输入微博" />

                </div>
            </div>

            <div class="col-md-6">
                <div class="form-group">
                    <label asp-for="QQ" class="control-label"></label>
                    <input asp-for="QQ" class="form-control" placeholder="输入QQ" />

                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                <div class="form-group">
                    <label asp-for="Remark" class="control-label"></label>
                    <textarea asp-for="Remark" class="form-control" placeholder="输入备注" rows="3"></textarea>
                </div>
            </div>
        </div>
    </div>

    <div class="modal-footer">
        <button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal">关闭</button>
        <button type="submit" class="btn btn-primary waves-effect waves-light">保存</button>
    </div>
</form>
<script>
    Ladda.bind('.btn-primary', { timeout: 1000 });

    $(function () {

        $('#upload').Huploadify({
            auto: true,
            fileTypeExts: '*.png,*.jpg',
            multi: false,
            fileSizeLimit: 2048,
            showUploadedPercent: false,
            showUploadedSize: false,
            removeTimeout: 10000,
            uploader: '/Teacher/UploadAvatar',
            onUploadStart: function (file) {

            },
            onInit: function (obj) {

            },
            onUploadComplete: function (file, res) {

                var response = JSON.parse(res);

                if (response.success) {
                    $(".avatar").prop("src", response.imageUrl);
                    $("#avatar").val(response.imageUrl);
                }

            }

        });


        $("#BirthDate").flatpickr({
            mode: "single",
            locale: "zh",
        });

    });
</script>



